/***********************************************************************
    filename:   CEGUIDirect3D9ViewportTarget.cpp
    created:    Fri Feb 13 2009
    author:     Paul D Turner
*************************************************************************/

#define NOMINMAX
#include "hgeViewportTarget.h"
#include "hgeRenderQueue.h"
#include "hgeGeometryBuffer.h"
#include "hgeExceptions.h"
#include <d3d9.h>

//----------------------------------------------------------------------------//
ViewportTarget::ViewportTarget(Renderer& owner) :
    RenderTarget(owner)
{
    // initialise renderer size
    D3DVIEWPORT9 vp;
    if (FAILED(d_owner.getDevice()->GetViewport(&vp)))
        throw RendererException("Direct3D9RenderTarget: Unable to access "
        "required view port information from Direct3DDevice9.");

	hgeRect area = hgeRect(vp.X, vp.Y, vp.X + vp.Width, vp.Y + vp.Height);
    setArea(area);
}

//----------------------------------------------------------------------------//
ViewportTarget::ViewportTarget(Renderer& owner, const hgeRect& area) :
        RenderTarget(owner)
{
    setArea(area);
}

//----------------------------------------------------------------------------//
bool ViewportTarget::isImageryCache() const
{
    return false;
}